package com.sa.web.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.sa.web.bean.StuDetailBean;
import com.sa.web.bean.StuDetailBeanView;
import com.sa.web.dao.service.StuDetailDao;

public class StuDetailDaoImpl implements StuDetailDao {
	
	private SqlMapClientTemplate sqlMapClientTemplate; 

	@Override
	public void addStuDetail(StuDetailBean stuDetail) {
		sqlMapClientTemplate.insert("addStuDetail", stuDetail);
		
	}

	/**
	 * 查询当前用户的上传资料详情
	 * @return StuDetail
	 */
	public List<StuDetailBean> getStuDetail(String stuName){
		return (List<StuDetailBean>)sqlMapClientTemplate.queryForList("getStuDetail",stuName);
	}

	@Override
	public List<StuDetailBeanView> queryStuDetail(StuDetailBeanView stuDetail,Integer start , Integer end) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("stuName", stuDetail.getStuName());
		map.put("type", stuDetail.getType());
		map.put("subType", stuDetail.getSubType());
		map.put("start", start);
		map.put("end", end);
		return (List<StuDetailBeanView>) sqlMapClientTemplate.queryForList("queryStuDetail", map);
	}

	@Override
	public Integer queryStuDetailCount(StuDetailBeanView stuDetail) {
		return (Integer) sqlMapClientTemplate.queryForObject("queryStuDetailCount", stuDetail);
	}

	public SqlMapClientTemplate getSqlMapClientTemplate() {
		return sqlMapClientTemplate;
	}

	public void setSqlMapClientTemplate(SqlMapClientTemplate sqlMapClientTemplate) {
		this.sqlMapClientTemplate = sqlMapClientTemplate;
	}
	
}
